package Demo4;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Test {
    public static void main(String[] args) throws Exception {
        StringBuffer stringBuffer = new StringBuffer("12345678");
        for (int i = stringBuffer.length()-3; i > 0; i-=3) {
            stringBuffer.insert(i,",");

        }
        System.out.println(stringBuffer);
//        SimpleDateFormat:格式化日期,可以把字符串和日期互换
        SimpleDateFormat data = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println(data.format(new Date()));

        Calendar calendar = Calendar.getInstance();
//        calendar.set(2012,12,12);
        System.out.println(calendar.get(Calendar.MONTH)+1);
        System.out.println(calendar.get(Calendar.DAY_OF_MONTH));
        System.out.println(calendar.get(Calendar.DAY_OF_WEEK)-1);
    }
}
